Пример данных
DECLARE @TempData AS TABLE ([Date] DATE, Scan_In VARCHAR(5),Scan_Out VARCHAR(5))
INSERT INTO @TempData
SELECT '2018-01-03' ,'Yes','Yes' UNION ALL
SELECT '2018-01-04' ,'No' ,'Yes' UNION ALL
SELECT '2018-01-07' ,'Yes','No'
SELECT * FROM @TempData
Sql SCript
DECLARE @GiveDate DATE,
@EndDate DATE,
@MOnth INT,
@YEAR INT
SELECT @MOnth=MONTH([Date]),@YEAR=YEAR([Date]) FROM @TempData
SET @GiveDate=CAST(CAST(@year AS varchar(4)) + '-' + CAST(@month AS varchar(2)) + '-' + '1' AS DATE);
SELECT @EndDate=EOMONTH(@GiveDate)
;WITH CTE
AS
(
SELECT DISTINCT Number,DATEADD(DAY,Number,@GiveDate) AS ReqDays
FROM master.dbo.spt_values WHERE Number BETWEEN 0 AND 100
AND DATEADD(DAY,Number,@GiveDate) BETWEEN @GiveDate AND @EndDate
)
SELECT c.ReqDays,
t.Scan_In,
t.Scan_Out
FROM CTE c LEFT JOIN @TempData t
ON c.ReqDays=t.[Date]
Демонстрационное решение: http://rextester.com/TNGU27548