My understanding of the WITH RECOMPILE
option with stored procedures is generally limited to using the clause with a single stored proc call as a trailing parameter:
exec sp_mystoredproc 'Parameter1', 2, '1/28/2011' with recompile
What are the effects of including WITH RECOMPILE
in the actual proc definition? Does this recompile the proc every time it's executed? Or just the next time the proc is altered?
Example:
CREATE PROCEDURE [dbo].[sp_mystoredproc]
(@string1 varchar(8000)
,@int2 int = 2
,@dt_begin DATETIME
with recompile
AS
... proc code ...