In a medium saucepan, whisk together sugar, cocoa powder, cornstarch, and salt.
Gradually whisk in the milk until smooth and well combined.
Place the saucepan over medium heat and cook, whisking constantly, until the mixture thickens and starts to bubble.
Continue cooking for 1 minute more, then remove from heat.
Stir in butter and vanilla until fully incorporated.
Pour the pudding into serving dishes and cover the surface with plastic wrap to prevent a skin from forming.
Refrigerate for at least 2 hours before serving for best texture.