I have an SQL Server 2008R2 containing lots of databases that come and go. Each time a database leaves the server or another one pops in, I need to go through a killer routine:

I run this script in SQL Management Studio

    SET NOCOUNT ON
    
    SELECT 'BACKUP DATABASE [' +
    name +
    '] TO  DISK = N''C:\Program Files\Microsoft SQL Server\MSSQL10_50.HART\MSSQL\Backup\' + 'BCK\' +name + 
    '.bak'' WITH NOFORMAT, INIT,  NAME = N''Full Database Backup'', SKIP, NOREWIND, NOUNLOAD,  STATS = 10'
    FROM sys.databases
    WHERE state_desc = 'ONLINE'
    AND name NOT IN ('master','tempdb','model','msdb','blah','blah2')
    
    SET NOCOUNT OFF

,I get the result to text and I paste it inside the SQL Agent Job Step window.

Is there a chance that I could put this script inside the SQL Server Agent Jobs so everytime a database leaves or gets into my Server I wont have to manually change my Job Step definition?

Thank you!