what is the difference between if i wrote the NOT query in the following ways.
SELECT iBatchID,COUNT(*) FROM #temp WHERE NOT iBatchID IN (1) GROUP BY iBatchID
SELECT iBatchID,COUNT(*) FROM #temp WHERE iBatchID NOT IN (1) GROUP BY iBatchID
what is the difference in between if i am using WHERE NOT iBatchID IN (1) and WHERE iBatchID NOT IN (1) ?
There is no difference. They will have the same query result.
And I believe the execution plans should be identical, but the best way to find that out is to capture the actual execution plans of each query.
I personally always choose
... WHERE SomeCol NOT IN (...), as it reads a little clearer than... NOT WHERE SomeCol IN (...). But this is all personal preference and what you feel to be more readable and maintainable.