1SELECT
2 x.*
3FROM
4 (
5 VALUES
6 ('emp1%', 3),
7 ('emp3%', 2)
8 ) AS v (pattern, row_count)
9 CROSS APPLY
10 ( -- your query
11 SELECT top (v.row_count)
12 employee_id, employee_ident, utc_dt, rx_dt
13 FROM employee
14 INNER JOIN employee_mdata_history
15 ON employee.ident=employee_mdata_history.employee_ident
16 WHERE employee_id like v.pattern
17 ORDER BY rx_dt desc
18 ) AS x
19;
20