title: Using the WITH RESULT SETS clause to explicitly describe the result set
body: <p>I've migrated a SQL Server database from 2012 to 2016 and I've noticed that a stored procedure is working fine on SQL Server 2012, but on 2016, I get this error:</p>
  
  <blockquote>
    <p>DATABASE.dbo.proc_DETAILS 6, 9, NULL, 1, NULL, 1<br>
    Msg 11514, Level 16, State 1, Procedure sys.sp_describe_first_result_set, Line 1 [Batch Start Line 14]<br>
    The metadata could not be determined because statement 'Execute(@Query)' in procedure 'proc_DETAILS'  contains dynamic SQL.</p>
    
    <p>Consider using the WITH RESULT SETS clause to explicitly describe the result set.</p>
  </blockquote>
  
  <p><code>proc_DETAILS</code> stored procedure is executed with </p>
  
  <pre><code>Execute(@Query)
  </code></pre>
  
  <p>How do I execute my stored procedure with <code>WITH RESULT SETS</code> clause?</p>