Good morning and Welcome to the Forum LLL:
I have a couple of ideas. First you could place the countertop on a couple of brackets (firmly attached to the studs) that were out of sight, away from the edges. OR, in the case of a masonry wall, you could use a couple of pieces of 1-1/4" pipe set in the wall and kept away from the edges.
A 1" x 4" trim board aporn on the countertop would stiffen the countertop and help conceal the brackets or pipes. If I have missed something here, please post back (maybe with pictures) and I will try to clarify.
Glenn