Pour the milk into a saucepan and add half of the sugar. Heat until it starts to simmer. Remove from the heat.
In a heat-safe bowl, add the rest of the sugar, egg yolks, salt, cornstarch, and vanilla. Whisk well, until the mixture is pale and smooth.
Slowly pour the hot milk into the egg yolk mixture whisking vigorously to prevent egg yolks from curdling.
Pour everything back into the saucepan. Heat over medium heat, stirring continuously.
Once the mixture starts boiling, cook for 1-2 minutes or until the mixture becomes pudding-like in consistency, and has no raw starchy taste.
Remove from the heat and add the butter. Whisk until the butter has fully melted and combined with the pastry cream.
Pour the mixture into a clean bowl and cover it with plastic wrap so it touches the surface of the pastry cream. Refrigerate until cold.
Once you’re ready to use it, whisk thoroughly with a metal whisk to make it smooth again. You can also use an immersion blender or a stand mixer to achieve extra smoothness more quickly.