I would like to know what options we have to do not make dynamic queries.
For example:
IF @Mail <> ''
BEGIN
    SELECT @Where = @Where + ' AND Mail =  @Mail '
END
ELSE IF @Phone <> ''
BEGIN
    SELECT @Where = @Where + ' AND Phone like ''%'' + @Phone '
END
I would like not do do this, I would like to avoid dynamic queries, if someone can help me.
By the way I want to filter by Mail, but if Mail does not exist then I have to filter by Phone, but never by both. 
 
     
     
     
     
     
    