DECLARE @SrcDB NVARCHAR(128) = 'DevlDUTASJobSchedule';
DECLARE @NewDB NVARCHAR(128) = 'TestDUTASJobSchedule';
DECLARE @Backup NVARCHAR(260) = '\\DOES-RAINVM-DEV\E$\Neeraj\SqlAgent\Backup\' + @SrcDB + '.bak';

-- Backup Source
BACKUP DATABASE @SrcDB TO DISK = @Backup WITH INIT, COMPRESSION;

-- Restore as Target
DECLARE @SQL NVARCHAR(MAX) = '
RESTORE DATABASE [' + @NewDB + '] 
FROM DISK = N''' + @Backup + ''' 
WITH MOVE N''' + @SrcDB + ''' TO N''\\DOES-RAINVM-DEV\E$\SQLData\' + @NewDB + '.mdf'',
     MOVE N''' + @SrcDB + '_log'' TO N''\\DOES-RAINVM-DEV\E$\SQLLogs\' + @NewDB + '_log.ldf'',
     REPLACE;';
EXEC(@SQL);
