title: Does "With recompile" recompile all the queries in stored procedure?
body: <p>So we have quite a large database and a stored procedure which searches through a large number of documents. Depending on the context, it either fetches millions of documents or just one hundred.</p>
  
  <p>Point is, the procedure takes 30 seconds for both millions and hundred documents which is surreal. If I add <code>OPTION (RECOMPILE)</code> after <strong>each</strong> of the five queries, it takes a second for 100 documents and (expected) 30 seconds for millions of documents.</p>
  
  <p>I've tried creating a procedure with <code>WITH RECOMPILE</code> option but it seems that it doesn't recompile queries in it.</p>
  
  <p>Is this correct? Does the <code>WITH RECOMPILE</code> on stored procedure recompiles inner queries or just the execution plan for an entire SP? How can I do this without repeating <code>OPTION (RECOMPILE)</code> after each query?</p>