title: Operand type clash: varchar is incompatible with varchar(50) trying to insert in encrypted database
body: <p>I am getting a <code>SqlException</code>:</p>
  
  <blockquote>
    <p>Operand type clash: varchar is incompatible with varchar(50) encrypted
    with (encryption_type = 'DETERMINISTIC', encryption_algorithm_name =
    'AEAD_AES_256_CBC_HMAC_SHA_256', column_encryption_key_name =
    'CEK_Auto1', column_encryption_key_database_name = 'PB')
    collation_name = 'SQL_Latin1_General_CP1_CI_AS'\r\nIncorrect parameter
    encryption metadata was received from the client. The error occurred
    during the invocation of the batch and therefore the client can
    refresh the parameter encryption metadata by calling
    sp_describe_parameter_encryption and retry.</p>
  </blockquote>
  
  <p>My C# code:</p>
  
  <pre><code>using (var connection = new SqlConnection(GetConnectionString()))
  {
      using (var cmd = new SqlCommand("Clients_Insert", connection))
      {
          cmd.CommandType = CommandType.StoredProcedure;
  
          cmd.Parameters.Add("@Email", SqlDbType.VarChar, 50).Value = client.Email;
          cmd.Parameters.Add("@ContactPerson", SqlDbType.VarChar, 400).Value = client.ContactPerson;
  
          connection.Open();
          cmd.ExecuteNonQuery();
      }
  }
  </code></pre>
  
  <p>And my stored procedure: </p>
  
  <pre><code>ALTER PROCEDURE [dbo].[Clients_Insert]
      @Email VARCHAR(50),
      @ContactPerson VARCHAR(400)
  AS
  BEGIN
      INSERT into dbo.Clients(Email, ContactPerson) 
      VALUES (@Email, @ContactPerson);
  
      SELECT SCOPE_IDENTITY();
  END;
  </code></pre>
  
  <p>I have no problems with inserting data into not encrypted fields.</p>
  
  <p>I found this article </p>
  
  <p><a href="http://dataap.org/sql-2016-ctp/column-level-encryption-using-always-encrypted-in-sql-server-2016/" rel="nofollow">http://dataap.org/sql-2016-ctp/column-level-encryption-using-always-encrypted-in-sql-server-2016/</a></p>
  
  <p>My issue is similiar but i haven't found the solution.</p>