Sometimes it is very important to query the database meta-data in order to be fast and efficient. SQL code to query the System Database metadata to find out which database has a table you are looking for is simply below:
Select * from sys.databases
WHEN state_desc = 'ONLINE'
THEN OBJECT_ID(QUOTENAME(name) + '.[dbo].[PutTheNameOfTable]', 'U')