How to achieve Dynamic SQL Query with Multiple parmeters to handle null values also
There is no harm in having unused parameters passed into sp_executesql.

You approach above is correct.  Declare and pass in all possible parameters for sp_executesql.  You will still get all the benefits of dynamic sql even with unused parameters.