ChrisM@Work (4/11/2013)
I only see one plan for the conditional select, the same plan whichever parameter I use. It's what I'd expect to see. Am I missing something?
If you run the following from two different sessions (I know I did), you get two plans generated for the stored proc.
create table #test (name nvarchar(max))
insert into #test values( 'John')
exec dbo.Test_Sproc @Debug=0 -- notice i am passing 0 and not 1 , so the block of code shouldn't be executed
drop table #test