I've added a BezierCurve, and beveled it with a square curve. The ends are square as expected, but the shading makes it look like a pipe (beveled with a circle). I would expect a shading more like the cube I've added for comparison.
Because by default is spline set under
Properties Editor > Data Properties > Active Spline as Smooth
When Smooth unchecked, curve become shaded Flat, which means flat also in curvature.
To make it smoother you can increase Resolution U (segment subdivisions)
But in some cases it would be still segmented ... so Edge Split modifier seems to be better choise anyway :)
Just for completeness, for a square profile, you don't need a profile object; this 3D curve has been given a native bevel at minimum resolution, all vertices tilted to 45 degrees...
And a curve can be given a Bevel Modifier to stand in the way of smooth shading interpolation over sharp corners: here, 2 segments with a profile shape of 1.
And the bevel is adjustable, if you do use a profile object: