Check out a tool and breakdown by Marc Chevry that will help you set up walls procedurally.
This tool by Marc Chevry will allow you to build a stone wall by drawing a curve on a terrain. The tool features several parameters allowing users to insert bridges, set wall height, stone size, wave effect, and more.
Please note that the tool was shared for educational purposes only but the artist has also shared a free step-by-step breakdown that will let you create your own tools. The breakdown can be found on ArtStation.
The file only includes procedural modeling and UVs of the wall but does not include procedural textures. Learn more and get the tool on Gumroad.