If the wall is built on your property, it belongs to you and you are responsible for maintaining it.
If it is built on your neighbour's property, your neighbour is responsible for it. He/she must maintain it and you are not authorised to use it as a support for another construction.
If it straddles the 2 properties, we call it a party wall. In this case, it belongs to both of you and you must maintain it jointly.
If in doubt, refer to the acts of ownership.
You should also be aware that if the top of the wall forms an inclined side, the wall belongs to the owner on whose property rainwater drains.