Heat milk in a heavy saucepan over moderate heat until hot, but not boiling.
While milk heats, whisk together yolks, sugar, cornstarch, and salt in a heatproof bowl until smooth.
Gradually add 1 cup of hot milk to yolk mixture, whisking constantly. Transfer egg mixture back to saucepan and cook over moderately low heat, stirring constantly, until thickened and registers 170°F on thermometer, 8 to 12 minutes (do not boil).
Take off heat and stir in butter and vanilla. Chill custard, its surface covered with wax paper, until cold and thickened, at least 3 hours.