Вы можете попробовать это:
DECLARE @input DATETIME='2018-05-24 15:00'
DECLARE @min INT=180
SELECT CASE WHEN DATEADD(MINUTE,@min,@input)>DATEADD(HOUR, 17,DateAdd(Day, Datediff(Day,0, @input), 0))
THEN DATEADD(MINUTE,
DATEDIFF(MINUTE,
DATEADD(HOUR, 17,
DATEADD(Day,
DATEDIFF(Day,0, @input),
0)
),
DATEADD(MINUTE,@min,@input)),
DATEADD(Hour,9,
DATEADD(Day,1,
DateAdd(Day,
Datediff(Day,0, @input),
0)
)
)
)
ELSE DATEADD(MINUTE,@min,@input)
END