In a small saucepan, place the milk over low-medium heat and bring to a simmer or about 190 degrees F (85 degrees C).
Meanwhile, in a medium bowl, vigorously whisk together the egg yolks, granulated sugar, and cornstarch until pale in color and the mixture flows off of the whisk.
Once the milk has reached a simmer, slowly pour half of it into the egg-sugar mixture while simultaneously whisking to temper the eggs. Pour everything back into the saucepan and place over medium heat. Use a rubber spatula to mix constantly as it thickens.
Once the pastry cream is thick and a few big bubbles come to the surface, continue whisking for one more minute, then remove the pan from heat.
Immediately add the butter and vanilla, and use an immersion blender (or rubber spatula) to combine. Pour the pastry cream through a fine mesh sieve into a small bowl to ensure it’s perfectly smooth.
Press plastic wrap up against the surface of the pastry cream to prevent a skin from forming, and place in the fridge to chill overnight or until ready to use.
Notes
It can be difficult to tell when milk is simmering sometimes, so it's best to go by temperature (190 degrees F).
If you're in a rush and cannot chill the pastry cream overnight, you can place the bowl of pastry cream in a large bowl with ice water and whisk constantly until it has come to room temperature.