The metadata could not be determined because every code path results in an error; see previous errors for some of these
<p>I am migrating from SQL Server 2005 to SQL Server 2014 and one of the queries stopped working in SQL Server 2014:</p>

<pre><code>select * 
from openrowset ('SQLOLEDB','Server=(local);TRUSTED_CONNECTION=YES;',' exec [MyDatabase].[dbo].[MyTable]')
</code></pre>

<p>I get the following error message:</p>

<blockquote>
  <p>Msg 11529, Level 16, State 1, Procedure sp_describe_first_result_set,
  Line 1<br>
  The metadata could not be determined because every code path results in an error; see previous errors for some of these. </p>
  
  <p>Msg 4902, Level 16, State 1, Procedure sp_describe_first_result_set, Line 1<br>
  Cannot find the object "#MyTempTable" because it does not exist or you
  do not have permissions.</p>
</blockquote>

<p><code>dbo.MyTable</code> and <code>#MyTempTable</code> are not real names.</p>

<p>What could cause this error? Any help would be appreciated.</p>

<p>Thanks</p>