Place the sugar, salt and corn starch in a saucepan and whisk to combine.
Add the egg yolks and whisk until the mixture is smooth and combined, about 1-2 minutes.
Pour in the milk and whisk again until all ingredients are combined.
Place the pot over medium heat and whisk the mixture. Occasionally scrap the bottom of the pan with a spatula to make sure the pastry cream does not stick to the bottom as it thickens.
The mixture will begin to thicken. Continue whisking until you see bubbles break the surface. Continue whisking for about a minute, while it is bubbling.
Remove from the heat and add the butter and vanilla extract. Mix until the butter is melted.
Pour the mixture through a mesh strainer into a bowl.
Place a piece of plastic wrap directly on the pastry cream and refrigerate at least 2 hours, ideally overnight.
When ready to use, remove the pastry cream from the fridge and beat with a whisk until smooth.