For the human reader, something like this seems to be preferred:
SELECT *
FROM apples
WHERE apple.color = COALESCE(@color, apple.color)
AND apple.time = COALESCE(@time, apple.time);
and I understand that some optimizers handle this very well. Sadly, SQL Server's is not one of them: the above will result in a table scan, as will variations on the theme :(
Tony Rogerson SQL Server MVP did some good analysis on this and concluded:
The only way in SQL Server... to get
an efficient, scalable and performant
solution is to either use a ton of IF
ELSE
control of flow blocks (one per
parameter combination) or use dynamic
SQL.
So the answer rather depends on whether you are writing code that is either easy to understand, maintain and port to other SQL platforms in the future or performs well on one optimizer today.