title: get OBJECT_ID in linked server
body: <p>Second select (from linked server) does not return any values.. Object_ID doesnt work. Is any workaround? </p>
  
  <pre><code>select '', name 
  FROM sys.databases
  WHERE 1 = 1
      AND NAME &lt;&gt; db_name() -- exclude current database
      AND CASE 
          WHEN STATE = 0
              THEN CASE 
                  WHEN OBJECT_ID(NAME + '.dbo.tPA_SysParam', 'U') IS NOT NULL
                          THEN 1
                      END
          END = 1
  union
  select '[LINKED]', name
  FROM [LINKED].master.sys.databases
  WHERE 1 = 1
      AND CASE 
          WHEN STATE = 0
              THEN CASE 
                      WHEN OBJECT_ID('[LINKED].'+NAME +     '.dbo.tPA_SysParam', 'U') IS NOT NULL
                          THEN 1
                      END
          END = 1
  </code></pre>