SQL Query with multiple conditions on date
You can use isnull to take care of the parameters when they are null.

Something like this should do what you want.

select T.*
from #TempTbl as T
where T.StartDtm &lt;= isnull(@StopDtm, '99991231') and 
      (T.StopDtm &gt;= isnull(@StartDtm, '17530101') or T.StopDtm is null)