Grill or broil the corn until kernels are lightly charred in spots, turning occasionally. Let cool, then cut the kernels off the cobs into a large bowl.
In a small bowl, stir together the mayonnaise, lime juice, chili powder, salt, and pepper until smooth.
Add the corn kernels, red onion, cilantro, and cotija cheese to the dressing. Toss gently to coat everything evenly.
Fold in the diced avocado last, stirring just enough to distribute without mashing the pieces.