Question :
Reading this answer I have a question about it:
How can I create a certificate with a private key in my app database?
Answer :
CREATE CERTIFICATE, see the first example Creating a self-signed certificate:
use <mydb>;
go
CREATE CERTIFICATE Shipping04
ENCRYPTION BY PASSWORD = 'mysecretpassword'
WITH SUBJECT = 'Used to signed procedure usp_foo',
EXPIRY_DATE = '20181231';
GO
When you sign with it you need to specify again the password:
ADD SIGNATURE TO [usp_foo]
BY CERTIFICATE <certname> WITH PASSWORD 'mysecretpassword';
See Signing an activated procedure for an example.