I have a stored procedure in which I have to join 10 tables and use WHERE
condition to filter the records based on the parameters passed in the stored procedure
You just need to give the parameters which are being used.
If only value for Var1 needs to be passed.
proc1 @Var1 = Var1Value
If the value for Var6 needs to be passed.
Proc1 @Var6 = Var6Value
Please use case in this like
where case @var1 when null then 1 else a.id end = case @var1 when null then 1 else @var1 end
Hope this will help you Thanks