title: SQL Server: Table-valued Functions vs. Stored Procedures
body: <p>I have been doing a lot of reading up on execution plans and the problems of dynamic parameters in stored procedures. I know the suggested solutions for this.</p>
  
  <p>My question, though, is everything I have read indicated that SQL Server caches the execution plan for stored procedures. No mention is made of Table-value functions. I assume it does so for Views (out of interest).</p>
  
  <p>Does it recompile each time a Table-value function is called?</p>
  
  <p>When is it best to use a Table-value function as opposed to a stored procedure?</p>