You can store a “list” of values in sql with a table variable.

DECLARE @listOfIDs TABLE(id INT);
INSERT INTO @listOfIDs
SELECT id
FROM Transactions
WHERE USER='bob';