Suppose you have three queries. The SP will only run one of them, based on IF-Then logic
if @p1 = 1 SELECT....FROM .....
ELSE if @p1 = 2 SELECT....FROM .....
ELSE if @p1 = 3 SELECT....FROM .....
Now if it were only one query instead of three I'm sure the optimizer would usually do a good job of creating, and caching, a suitable plan (probably 90% of the time).
Is the optimizer just as reliable (say 90%) when there are three queries involved? Or is it more likely, in this scenario, that two of the queries will NOT get optimized?