If you are sure you want to do that............
select 'alter authorization on database::['+name+'] to [sa]'
from master.sys.databases where database_id > 4 -- DO NOT change ownership of system databases
---------------------------------------------------------------------