Looking to change the schema/owner on a stored procedure that you’ve restored from a different MSSQL database server. The following took me a while to work out based on all the different options. sp_changedbowner did not work for me, I had to change the schema rather than the actual owner.
ALTER SCHEMA [new schema name] TRANSFER [old schema].[stored procedure/object]
example:
ALTER SCHEMA dbo TRANSFER databdev.sp_ASPBannner_DBinfo
This was annoying to find especially as I was initially getting ‘Cannot find the object ‘sp_ASPBannner_DBinfo’, because it does not exist or you do not have permission’ and similar errors.
Jay Greig