You mustshould use the auxiliary verb did, emphasizing the general action of sleepwalking.
You wouldn't know if you sleepwalk.
You wouldn't know if you did [sleepwalk].
Had is the past perfect, and requires the past participle sleepwalked. If Speaker A was referring to a past event of sleepwalking rather than sleepwalking itself, this would be better.
I didn't sleepwalk.
You wouldn't know if you had [sleepwalked].