Custom SQL query with multiple optional parameters and conditions

Creating query in strings - when params might be involved - sounds like inefficient code.
Have you seen this: Using condition with conditional fields in custom queries - #4 by sid ?