You need to convert your query into something like:
DECLARE @fooId INT = 11764;
DELETE FROM bar
WHERE fooID = @fooID
DELETE FROM foo
WHERE ID = @fooId
By first declaring the @fooId
variable the code easier to reuse if you want to delelte more than one item.
If you want to delete many items, according to some condition, you could declare a table variable where you put the ids:
DECLARE @deleteItems TABLE
(
ID INT
);
INSERT INTO @deleteItems (ID)
SELECT ID FROM foo WHERE <your conditions here>
DELETE FROM Bar
WHERE FooID in (SELECT ID FROM @deleteItems)
DELETE FROM Foo
WHERE ID in (SELECT ID FROM @deleteItems)
It might also be appropriate to put BEGIN TRANSACTION
at the beginning and COMMIT TRANSACTION
at the end to make sure that the updates are atomic