A couple methods that I use:
1. Indoors. Bring a pot of water to a boil (enough to cover all corn ears being cooked). If not already cleaned, strip all leaves and corn silks from each ear, snap off the stem. Rub (or use a vegetable brush on the ears under cool running water to remove any remaining silks. Trim of anything you feel that you need to remove from the ears (pointy end that is damaged or not filled out, etc.). With the water boiling, place the cobs in the pot with tongs, return to a boil (covering helps increase the temperature faster). You want less, not more, cooking time (I would try 5 minutes at a boil, at most, to keep most of the flavor and texture).
2. Outdoors on a charcoal grill (you could probably use gas too). Clean as above.
Each ear of corn should be wet. Place ear on a separate piece of foil. Top with a couple pats of butter per ear, close (wrap) the foil around the ear. Place on a hot grill with the charcoal hot and ready for cooking. When you start hearing some sizzle in the foil, you periodically want to turn the wrapped ears for even cooking. Cooking takes up to 15 minutes if you turn it periodically.
3. Another outdoor method is to cook in the corn husk. Here are some instructions:
https://www.acouplecooks.com/grilling-corn-in-husk/ The best corn on the cob (most memorable) was cooked this way, at the Indiana State Fair, I still remember the taste from my childhood. It is more work to cook this way, but in my opinion, it is worth the effort.