a low protective wall along the edge of a roof, bridge, or balcony.
"she stood on the bridge, leaning over the parapet to watch the water race by"
This is a definition from Google. There are likely to be stricter definitions in architecture than in literature or military usage, for example.
Widow's Walk and Captain's ...
If it was a proper area where people could walk, then the fence would be a Handrail, or Balustrade, or a Railing, and it would be a Balcony or Tower, or a Lookout. If there was a roof over the standing area, then it could also be a Porch.
This assumes there's a doorway or some other convenient access, that isn't "climbing up the outside ...
It's called a "Widow's Walk". The name stems from the fact that it was a prominent feature in homes near the sea, where wives of seafarers would (presumably) go to stare out at the ocean, hoping to see their husbands returning, but often finding out that they were widows.