Q:

Performance hit using ' where id IN [table] ' with only 1 row in [table]?

I have a stored procedure that takes a comma-delimited string of IDs. I split them and put them into a temporary table and pull out records from another table using where id IN [table]
Is it ok to use this same procedure when only one id is passed in for the param? I could write a second stored procedure that would do exactly the samething but instead do where id = @id.
I have MANY stored procedures where multiple IDs or just one could be passed in. Do I try to reuse the existing procedures or write new ones? Is the performance hit significant?

A:

You might like to try a JOIN instead of WHERE id IN - although I think you will get the same query plan.
So I assume you are doing:
SELECT COl1, Col2, ...
FROM MyTable
WHERE id IN (SELECT id FROM @MyTempTable)

in which case the equivalent JOIN syntax would be :
SELECT COl1, Col2, ...
FROM  MyTable AS T1
     JOIN @MyTempTable AS T2
         ON T2.id = T1.id

and in the second case whether there is 1, or many rows, it will be very effective provided [id] is indexed (I am assuming it is the PK on your table, and using a Clustered Index).
(Beware that if you have DUP IDs in @MyTempTable you will wind up getting dupes from MyTable as well :( )
For best performance it would be worth explicitly declaring [id] as the PK on your temporary table (but given it only holds a few rows it probably won't make much odds)
DECLARE @TempTable TABLE
(
    id int NOT NULL,
    PRIMARY KEY
    (
        id
    )
)

