Just a quick one – I needed to find which databases held a particular table:
EXEC sp_msforeachdb 'use [?] SELECT ''?'' as [datbaseName],SCHEMA_NAME(schema_id) as [schemaName], name as [tableName] FROM sys.tables where name = ''MY_TABLE'''
Just replace MY_TABLE with the name of the table you’re looking for.