Whisk together the sugar, cornstarch, and salt in a saucepan.
Pour 1/4 cup of the milk into the sugar mixture, stirring to form a smooth paste. Whisk in the remaining milk and the egg yolks.
Cook the pudding mixture over low heat, stirring continuously with a wooden spoon until thickened, about 15 minutes. Do not allow it to boil. Remove from heat and stir in the butter and vanilla.
Scrape the pudding into a bowl. Cover with plastic wrap, pressing the surface to make an airtight seal and prevent a skin from forming. Refrigerate until well chilled, about 1 hour.