SELECT 'ALTER AUTHORIZATION ON DATABASE::' + QUOTENAME(d.[name]) + ' to sa'
FROM [sys].[databases] d
INNER JOIN [sys].[server_principals] s ON s.sid = d.owner_sid
WHERE d.[name] NOT IN ('master','msdb','model','tempdb')
	AND s.[name] <> 'sa'