Ads will take the form of sponsorship idents in the final slot before the previews, with the line 'Anchor Real Dairy Cream sponsors summer family films'.
The Shrek 2 tie-up could prove lucrative for Anchor, with the US release threatening to break the record for first weekend takings set by Spider-Man in 2002.
The ident will run for 13 weeks from 25 June and will feature the cartoon cows from the TV ads performing in front of a cow 'director'.
Anchor has increased marketing spend from £3.6m in 2003 to £13.4m this year.