DECLARE @StartDate AS DATE
DECLARE @EndDate AS DATE
DECLARE @CurrentDate AS DATE

SET @StartDate = GETDATE()
SET @EndDate = DATEADD(MONTH, -18, @StartDate)
SET @CurrentDate = @StartDate

WHILE (@CurrentDate > @EndDate)
BEGIN

    PRINT @CurrentDate

    SET @CurrentDate = DATEADD(DAY, -1, @CurrentDate); 
END

