Find a table or stored proc in all databases in the same server

Use this SQL script to find a table or a stored proc in all databases in the same server.

sp_MSforeachdb 'select "?" AS DatabaseName, * From ?..sysobjects 
where xtype in (''U'', ''P'') And name = ''table or stored proc name'''

This query can be run in any database context.

Example result

enter image description here