How to exclude weekends and holidays in a query
You Can simply use datediff function of sql. and then you can subtract weekends between those dates if any.Here Sunday is set as a firstday of week, For example check below query. 

Declare @startdatee as DateTime
Declare @enddatee as DateTime
Set @startdatee = GETDATE();
set @enddatee = GETDATE()+1;
select @startdatee,@enddatee,(datediff(day,@startdatee,@enddatee+1)-(2)*datediff(week,@startdatee,@enddatee))


And If You want to exclude holiday's too, then, You also can calculate holidays between start/end date and can subtract that from final selection.
i gave you example here.
You can use your holiday's table,here i am just using temp table for example.

Declare @holidays Table (ID int,Name Varchar(50),[Date] date)
Insert into @holidays VALUES 
(1,'holiday1','2018-07-07'),
(2,'holiday2','2018-07-12')

Declare 
    @startdate datetime = '2018-07-02',
    @enddate datetime =  '2018-07-30',
    @holiday int = 0

    Set @holiday = (Select COUNT(*) FROM @holidays WHERE (Date BETWEEN @startdate AND @enddate) 
                    AND DATEPART(Weekday,Date) not in (1,7)
                    )

SELECT
   (DATEDIFF(dd, @StartDate, @EndDate) + 1)
  -(DATEDIFF(wk, @StartDate, @EndDate) * 2)
  -(case datepart(dw, @StartDate) when 1 then 1 else 0 end) 
  -(case datepart(dw, @EndDate) when 7 then 1 else 0 end)
  -@holiday