Many thanks! I absolutely loved this. I need to make a copy of my current dev db so many times. This will be a great time saver. I did make a few minor tweaks to the declare section, which I think make it more readable/usable (but I know this can always be a bit subjective). 🙂
DECLARE @FirstDBName NVARCHAR(100) = 'Mitesh01'
DECLARE @NewDBName NVARCHAR(100) = 'Mitesh02'
DECLARE @BackupLocation NVARCHAR(100) = 'C:\Backup\'
SELECT @fileName = @BackupLocation+@FirstDBName+REPLACE(REPLACE(REPLACE(CONVERT(VARCHAR(16),SYSDATETIMEOFFSET(),120),'-',''),':',''),' ','')+'.bak'