• Do you really need dates that old?

    You could use

    select datediff(d, '18000106', @dateTo)/7 - datediff(d, '18000107', @dateFrom)/7

    instead. Note that

    select datediff(d, '18000106', '1900-01-03')/7 - datediff(d, '18000107', '1899-12-29')/7

    gives you one Monday.

    My formula needs two reference dates, a Monday (e.g. 1900-01-01 or 1800-01-06) and the following Tuesday (e.g. 1900-01-02 or 1800-01-07). Both @dateFrom and @dateTo must be larger than these days for the formula to work. But OK, you found the weak point