>>I am trying to make a query that...If you need a programmatic version this should do it:declare @object_name sysnameset @object_name = '<Object to be found>'declare @dbid int ,@oid int ,@sql nvarchar(500) ,@parms nvarchar(200)set @parms = N'@oid int output'--itterate through all databases on serverselect @dbid = min(dbid) from master..sysdatabaseswhile @dbid is not nullbegin --set a command string to look for object in <current database> set @sql = 'select @oid = object_id(''' + db_name(@dbid) + '..' + @object_name + ''')' --execute the command exec sp_executesql @sql, @parms, @oid = @oid output --if id is found print the name of <current database> if @oid > 0 print db_name(@dbid) --get next database select @dbid = min(dbid) from master..sysdatabases where dbid > @dbidendBe One with the OptimizerTG