EXEC sp_msforeachdb
‘if exists(select 1 from [?].sys.objects where name=”usp_mystoredprocedure”)
print “?”‘
database name
T-SQL to find out the database with the object name – SQL server
EXECUTE master.sys.sp_MSforeachdb ‘USE [?];select “?” as databasename; select * from sys.objects where name like “startup” ‘