Does pesto contain lactose?
Yes. Genoese pesto contains parmesan and pecorino, so it contains cheese. They are aged cheeses, where ageing cuts the lactose down, but industrial pesto often adds milk powder or whey for texture — and those do carry lactose.
Eating out
Cheese-free pesto exists, but it is not the standard one: you have to ask for it, and you can taste the difference.
Recipes change from one producer to the next and from one kitchen to the next: this is how something is usually made, not what is in the plate in front of you. The only answer that holds for your plate is the ingredient list on the packet, or the person who cooked it.
And how did it go at the restaurant?
Knowing what is in a dish is half the answer. The other half is what actually happened to the people who ate it in a specific place — and that is what SafeBelly collects: no stars, just how it went afterwards.
Open the map and see who has been there