- I have noticed sp_executesql also makes a single plan for a stmt with parameter in a loop.
- q1) Generally plan is evicted from cache from first in first out or usage basis.so if i use sp_executesql then i should be fine in a loop in stored procedure or from .net or i must use sp_prepare and sp_execute in a loop?
if sp_executesql does my job then where exactally sp_prepare and sp_execute comes in to picture ( theortically it says sp_executesql only resues the plan it is cache and plan cache evicts unused plan first)