In a medium saucepan, heat the milk over medium heat until it begins to simmer.
In a separate bowl, whisk together the egg yolks and sugar until pale and fluffy.
Add the cornstarch to the egg mixture and whisk until combined.
Once the milk is simmering, slowly pour it into the egg mixture while whisking constantly.
Return the mixture to the saucepan and cook over medium heat, whisking continuously.
Cook until the mixture thickens and starts to bubble.
Remove from heat and stir in the vanilla extract and butter until smooth.
Strain the pastry cream through a fine sieve to remove any lumps.
Cover with plastic wrap, pressing it directly onto the surface to prevent a skin from forming.
Chill for at least 2 hours before using.