use a cte to get all the dates, join with the subjects to count the number of lessons and join with the holidays to exclude them:
declare @startdate date;
set @startdate = '2014-01-01';
declare @enddate date;
set @enddate = '2014-12-31'
;with DateRange AS
(
SELECT
@startdate as DateValue
UNION ALL
SELECT
dateadd(dd,1,DateValue)
FROM DateRange
WHERE dateadd(dd,1,DateValue) <= @enddate
)
select
s.Name
, COUNT(*)
from DateRange d
join SubjectsToDay s
on DATENAME(dw,d.DateValue) = s.Day
left outer join
Holidays h
on d.DateValue = h.Date
where h.Reason is null
group by
s.Name
option (maxrecursion 365)