How to escape percentage sign(%) in sql query with $wpdb->prepare?

This is an incorrect use of prepare, that function is used to safely insert variables into queries. However the code in your question does this beforehand, bypassing the security function.

E.g.

What you did:

$unsafesql = "INSERT $dangerousvariable";
$still_unsafe_sql = $wpdb->prepare( $sql, '' );

What it should be:

$safe_sql = $wpdb->prepare( "INSERT %s", $dangerousvariable );

error code: 523