Dynamically changing searches based on the given parameters is a complicated subject and doing it one way over another, even with only a very slight difference, can have massive performance implications. The key is to use an index, ignore compact code, ignore worrying about repeating code, you must make a good query execution plan (use an index).
Read this and consider all the methods. Your best method will depend on your parameters, your data, your schema, and your actual usage:
Dynamic Search Conditions in T-SQL by by Erland Sommarskog
The Curse and Blessings of Dynamic SQL by Erland Sommarskog
this will produce the best execution plan:
IF @flag=1
BEGIN
SELECT
[field]
FROM [table]
WHERE col1 = @value
END
ELSE
BEGIN
SELECT
[field]
FROM [table]
WHERE col2 = @different_value
END
However, if you have to have a single query, this is your best bet at using an index
SELECT
[field]
FROM [table]
WHERE @flag=1
AND col1 = @value
UNION ALL
SELECT
[field]
FROM [table]
WHERE @flag!=1
AND col2 = @different_value