SQL query - STUMPED

DECLARE @Contracts TABLE (OperatorId INT, Operator VARCHAR(20), dDate DATETIME, ContractNo VARCHAR(20))
INSERT INTO @Contracts
SELECT
5,'Nigel Tuffnell','2019-12-10','15741'
UNION ALL
SELECT
5,'Nigel Tuffnell','2019-12-10','3/15747'
UNION ALL
SELECT
5,'Nigel Tuffnell','2019-12-11','3/15747'

DECLARE @Dates TABLE (dDate DATETIME)
INSERT INTO @Dates
SELECT
'2019-12-09'
UNION ALL
SELECT
'2019-12-10'
UNION ALL
SELECT
'2019-12-11'
UNION ALL
SELECT
'2019-12-12'
UNION ALL
SELECT
'2019-12-13'
UNION ALL
SELECT
'2019-12-14'
UNION ALL
SELECT
'2019-12-15'

I can achieve the 'current result' but not the 'desired result', i.e. i want to remove unecessary rows, e.g. NULLS and, in this example, row 4 in the first result set should be merged with row 3. Hope this makes sense.

DECLARE @end_date date
DECLARE @sql nvarchar(max)
DECLARE @start_date date

SET @start_date = '20191209'
SET @end_date = '20191215'

SELECT @sql = STUFF((
    SELECT ',MAX(CASE WHEN dDate >= ''' + CONVERT(varchar(10), dDate, 112) + ''' AND ' +
        'dDate < ''' + CONVERT(varchar(10), DATEADD(DAY, 1, dDate), 112) + ''' ' +
        'THEN ContractNo ELSE '''' END) AS [' + CONVERT(varchar(10), dDate, 103) + ']'
    FROM (
        SELECT *, ROW_NUMBER() OVER(ORDER BY dDate) - 1 AS date_count
        FROM #Dates
    ) AS dates
    FOR XML PATH(''), TYPE).value('.', 'nvarchar(max)')
    , 1, 1, '')

--PRINT @sql

SET @sql = '
SELECT Operator, ' + @sql + '
FROM (
    SELECT *, ROW_NUMBER() OVER(PARTITION BY OperatorId, 
        DATEADD(DAY, DATEDIFF(DAY, 0, dDate), 0) ORDER BY dDate) AS row_num
    FROM #Contracts
) AS contracts
GROUP BY Operator, row_num
'

PRINT @sql
EXEC(@sql)