I have recently joined a software project that has approximately 20-40 databases.
Each database has at least 200 stored procedures, some of them have many more, so it i
I think the simplest way is to use the undocumented stored procedure sp_MSForeachdb which executes a command for each database:
sp_MSForeachdb
EXEC sp_MSforeachdb ' USE ? IF EXISTS ( SELECT 1 FROM sys.objects WHERE name = ''XYZ_procedure'' ) SELECT DB_NAME(); '