--eliminates database owned by sa, and read only databases
sp_msforeachdb 'USE [?]; if exists(
SELECT Name, SUSER_SNAME(owner_sid) from sys.databases
where name = ''?'' and isnull(SUSER_SNAME(owner_sid),'''') <> ''sa'' and is_read_only = 0) EXEC dbo.sp_changedbowner...