A square prism is a cube. The equation that represents the volume of a cube is:
length*width*height
or, in your case, b*b*h
If you are talking about a square-based pyramid, then you use 1/3 * length * width * height or 1/3 * b * b * h. You can use the exponents where needed.