In this case either you need to modify the input parameters of the SP or you need to send null values from front-end. I would suggest you to use modify input parameter of the sp as null. Try this:
SQL:
CREATE PROCEDURE spTest
@Param1 INT = NULL,
@Param2 DATETIME = NULL
AS
BEGIN
END
If user has entered or selected the values then only add the parameters to the command object.
Front-end:
if (textbox1.Text.Trim() != "")
{
cmd.Parameters.Add("@Param1", Convert.ToInt32(textbox1.Text));
}
if (datetimepicker.SelectedDate.HasValue)
{
cmd.Parameters.Add("@Param2", datetimepicker.SelectedDate);
}
All the best.
--Amit