An example of a system for delivering neurostimulation energy may include a stimulation control circuit to control the delivery of the neurostimulation energy according to each of stimulation test patterns. The stimulation control circuit may include a sensing input configured to receive an electrospinogram (ESG) signal recording electrical activity from the spinal cord, a measurement circuit configured to determine one or more response parameters for each test pattern using the received ESG signal, and a selection circuit configured to select a neurostimulation therapy pattern from the stimulation test patterns based on the response parameter(s) and one or more selection criteria. The electrical activity includes responses to the delivered neurostimulation energy, and the response parameter(s) are each indicative of one or more characteristics of the responses. The selection may include selecting a type of stimulation waveform from multiple types of stimulation waveform in the stimulation test patterns.