Change the MSSQL schema owner

The following SQL statement will create new queries (this way you can verify them) to change the current schema owner for all tables owned by the old owner.

DECLARE @current_owner NVARCHAR(100);
SET @current_owner='';
SELECT 'ALTER SCHEMA dbo TRANSFER ' + @current_owner + '.' + TABLE_NAME + ';' FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA=''+@current_owner+'';