The idea of being able to peek over a hill and fire has been most successfully done using guided missiles. Since the weapon is guided, depression is not an issue. All that is required is a lock on the target. A typical example is the M901 ITV "Hammerhead" which features a large TOW missile turret on the roof along with its sights. Only the turret need be visible. It can be raised and lowered.
Taking it a step further, since the missile is guided only the sights need to be visible. The vehicle can remain hidden behind a slope with only the sights poking up. The missile is fired, arcs up over the slope, and then down to the target. The AH-64D Apache Longbow used this system.
Finally, if a missile can fire over a slope, why endanger the vehicle at all? Various missile systems have allowed the sights to be separated from the launcher. The British Swingfire was perhaps the weirdest. It was a wire-guided anti-tank missile. The crew could dismount and take the control unit 100 meters away. When the missile was fired it make up to a 90 degree turn to fly from the vehicle into the gunner's line of sight. The gunner then had to guide it to the target.
But you asked for a gun on a tank.
The idea of an externally mounted gun has been around since the 70s. The British tried the COMRES 75.
The Swedes tried with the UDES-19 and UDES-20, a light tank. Here's Curator Stefan Karlsson showing off their UDES-20 at the Arsenalen tank museum.
The closest to your question would be the AAI RDF Block 2 "Elke" light tank. This fielded the terrifying XM274 Hypervelocity 75mm Autocannon in an unmanned, exposed turret capable of being raised. The XM274 featured a unique rotating chamber which allowed the gun to be loaded vertically from the bottom and rotated in line with the breech. This allowed only the gun to be exposed, and it could be loaded at any elevation.
The general idea of remote overhead weapons systems has gained popularity, especially as remote optics have become better, for machine guns, grenade launches, and small autocannons. But it has not caught on for a tank cannon. In part because ATGMs work just fine, and in part because light tanks have fallen out of favor. An external, unarmored gun is fine if you're always behind a slope, but a tank should be able to fight in more situations.
Nicholas Moran aka "The Chieftain" talks about the Elke and the XM274 listing its problems. To get the high rate of fire of 120 rounds per minute the gun is fired out of battery meaning the gun is constantly in motion while firing, there isn't even a fraction of a second to stabilize the gun. Later prototype vehicles dispensed with that idea and lowered the rate of fire to about 60 rpm. Heat dissipation was also a problem. The recoil of a 75mm hypervelocity cannon on the support arms would likely have become a problem in production. They also tried a 90mm gun. However, The Chieftain sums it up like so: "what the hell is the point of a 75mm gun which fires 2 rounds per second... especially on a smaller vehicle with limited ammunition supply".