Heat milk in a saucepan until just steaming
Whisk egg yolks, sugar, and cornstarch in a bowl until smooth
Slowly pour some hot milk into the egg mixture while whisking constantly
Pour the tempered mixture back into the saucepan
Cook over low heat, stirring constantly, until thickened
Remove from heat
Stir in vanilla and butter, if using
Strain the custard through a fine sieve for extra smoothness
Cover with plastic wrap touching the surface
Chill until cold before using
