SELECT *  FROM Md.Tags  INNER JOIN Md.TagTypes ON Tags.TagTypeID = TagTypes.TagTypeID WHERE (CASE   WHEN ISNULL(@SearchText,'') = '' THEN 1   WHEN Title LIKE '%' + @SearchText + '%' THEN 1  ELSE 0  END) = 1  AND TagID <> 0  AND TagID <> 1 /* Escalated */ ORDER BY Title