You'll need to change the data types of the parameters to match the columns in your table, but this should do itCREATE PROC YourProcName(@FromDate datetime = NULL, @ToDate datetime = NULL,@Dept int = NULL,@SONumber int = NULL,@Item varchar(20) = NULL,@Sect varchar(20) = NULL)ASSELECT DISTINCT [1_Job - Parent].SONumber, [1_Job - Parent].Department_Name, [1_Job - Parent].ItemNumber, [1_Job - Parent].SectNumber, [1_Job - Parent].RecordInitiateDate, [1_Job - Parent].MechUser, [1_Job - Parent].ElecUser, [1_Job - Parent].GreenTagUser, [1_Job - Parent].GreenTagDate, Ref_DepartmentID.[ID]FROM Ref_DepartmentID RIGHT JOIN [1_Job - Parent]ON Ref_DepartmentID.[ID] = [1_Job - Parent].DepartmentIDWHERE ([1_Job - Parent].RecordInitiateDate BETWEEN @FromDate AND @ToDate OR (@FromDate IS NULL OR @ToDate IS NULL)) AND (Ref_DepartmentID.[ID] = @Dept OR @Dept IS NULL) AND ([1_Job - Parent].SONumber = @SONumber OR @SONumber IS NULL) AND ([1_Job - Parent].ItemNumber = @Item OR @Item IS NULL) AND ([1_Job - Parent].SectNumber = @Sect OR @Sect IS NULL)ORDER BY [1_Job - Parent].RecordInitiateDate DESC