• This is the proper syntax for the sp_MSforeachdb. I've tested this successfully in SQL 2008 R2, but it should be good for 2005 on up.

    EXEC sp_MSforeachdb

    '

    EXEC [?].[dbo].sp_changedbowner @loginame = N''sa'', @map = ''false''

    '

    You can also add or remove selectively. The below shows NOT IN and will change all databases except those listed, but you can of course use IN instead if you only want to change a specific few that you know the names of:

    EXEC sp_MSforeachdb

    '

    IF ''?'' NOT IN (''master'',''msdb'',''model'',''tempdb'')

    EXEC [?].[dbo].sp_changedbowner @loginame = N''sa'', @map = ''false''

    '