As far as I know there is no "out of the box" way like Option(recompile)
, however I remember I found a way to fool the optimizer. It seems to sniff only the parameter that you're actually PASSING externally to the query, not all of them. So, if you try to run
SELECT MyField1, MyField2 FROM MyTable WHERE MyOtherField = @MyParm
Parameter sniffing WILL happen, however if you write something like
DECLARE @MyUnsniffableParm varchar(30)
SET @MyUnsinffableParm = @MyParm
SELECT MyField1, MyField2 FROM MyTable WHERE MyOtherField = @MyUnsniffableParm
ad of course pass to your script just the @MyParm
parameter, parameter sniffing doesn't seems to happen! Let me know If I recall correctly I have no SQL 2000 instances to try!
EDIT:
Looks like something else is doing the same out here: http://blogs.msdn.com/b/khen1234/archive/2005/06/02/424228.aspx